var app = getApp();
var Base64 = require('../../utils/base64.js').Base64;
Page({
  data: {
    username: "1222",
    password: "12345611",
    abtn: true,
  },
  login: function (e) {
    this.setData({ abtn: false })
    // var username = this.data.username;
    // var password = this.data.password;
    // console.log(Base64.encode(username+":"+password));
    // app.ajax('http://apis.example.com.cn/login',null,null,null,null,{
    //         "Authorization": "Basic " + Base64.encode(username+":"+password),
    //   })
  },
  onLoad: function (o) {
    this.setData({ username: o.id })
  },
  bindInput: function (e) {
    var dn = e.target.id;
    var v = e.detail.value;
    this.data[dn] = v;
    this.setData({ username: v })
    console.log(this.data.username);
  },
  sc: function () {
    var that = this;
    wx.scanCode({
      onlyFromCamera: true,
      success: (res) => {
        console.log(res)
        that.setData({ username: res.result })
      }
    })
  }
})